package me.keiwu.user.domain;

import lombok.Data;
import org.hibernate.annotations.ColumnDefault;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Created by kei on 30/01/2018.
 */
@Entity
@Data
@Table(uniqueConstraints = {
        @UniqueConstraint(name = "idx_user_medal", columnNames = {"userId", "medalId"}),
})
public class UserMedal {

    @Id
    @GeneratedValue
    private Long id;

    private Long userId;

    private Integer medalId;

    private Integer getTime;

    @ColumnDefault("0")
    @Column(columnDefinition = "TINYINT", nullable = false, length = 1)
    private boolean display;

}
